package com.parking.bang.rpc.core.client;

import com.parking.bang.rpc.serialize.base.RPCSerializeProtocol;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class RPCClientChannelInitializer extends ChannelInitializer<SocketChannel> {
	private RPCSerializeProtocol rpcSerializeProtocol;
	private RPCClientSerializeSelector serializer = null;

	RPCClientChannelInitializer setProtocol(RPCSerializeProtocol rpcSerializeProtocol) {
		this.rpcSerializeProtocol = rpcSerializeProtocol;
		return this;
	}

	protected void initChannel(SocketChannel socketChannel) throws Exception {
		ChannelPipeline pipeline = socketChannel.pipeline();
		serializer.select(rpcSerializeProtocol, pipeline);
	}

}
